package com.example.javabasic.thread.classtwo.singleton.demo1;
//用枚举的方式创建单例
public class SingleFour {
    private SingleFour(){}

    private enum Single{
        INSTANCE;
        private final SingleFour instance;
        Single(){
            instance = new SingleFour();
        }
        public SingleFour getInstance(){
            return instance;
        }
    }

    public static SingleFour getInstance(){
        return Single.INSTANCE.getInstance();
    }

}
